-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Allow GROMACS water molecules to be flagged as crystal waters #96
Conversation
Just to say that I'm not sure if this falls under fix or feature. Clearly the particular use case of this update is fixing unintended behaviour when solvating, but I think it will be included with a more general update to the |
Everything works as expected in BioSimSpace. Phew! |
Actually, it's not working properly because the Sire GroTop parser doesn't seem to be able to handle multiple types of water molecule in the same file, so they either all get converted to the default template This will need a rethink. |
I guess this can be solved by changing one of the parameters for the molecule that won't affect the calculation by |
Nope, that doesn't work either, since it seems to get the mass from the element. |
Hmmm, nothing seems to work, and I get a different topology file depending how the different water molecules (crystal and normal) are arranged in my system. Perhaps we'll need to use entirely different water templates for the crystal waters. If so, it's probably easier for me to just use a different approach for handling the This has also made me realise that the request in OpenBioSim/biosimspace#148, i.e. not changing the existing water topology on write on solvation, is not possible with the current GroTop parser, i.e. if there are other water molecules in the system then the molecule types will always be de-duplicated. (This is what you'd want for the purposes of running anything with GROMACS.) You should always be able to reference your original waters by index anyway. |
The key line that detects water molecules in a GroTop file is here: sire/corelib/src/libs/SireIO/grotop.cpp Line 4345 in 492fb7a
In theory, we could add an extra property, e.g.
Then the crystallographic waters will be treated as separate objects, and won't be combined with all of the other water molecules. The Another approach could be to change the elements or do something that means that Or, to go deeper, we could add a
and then we could use
What approach do you think would be best? |
(or, we could add a way of marking a water molecule as something that should not match the |
Aha, I didn't realise that you were now using the water search functionality. Yes, it should be pretty robust. I wrote it because I needed to be able to detect and swap water topologies in BioSimSpace, and this is obviously painful in Python for any reasonable number of water molecules. In this case the crystal waters will have a very specific formatting since this is something that is only implemented as a fix behind the scenes. It should be simple enough to combine the water search with a residue name match to extract them, e.g. xtal_waters = mols["water and resname XTL"] I'll have a play with this tomorrow. Thanks for the pointers! |
That said, having the ability to flag something as not searchable might be quite useful, e.g. by adding a specific property to a molecule. This would help in the situation where we do want to preserve some user naming for a topology, but don't know what that naming would be, i.e. don't have an easy way to search for it. |
Great, that works perfectly, i.e. adding excluding crystal waters from the search, then adding a separate search to define a new molecule type for them. I'll see how easy it is to add in a check for an I somehow hadn't noticed that the water searching that I wrote with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good - I would put this under "feature" rather than "fix" as it adds new capability that involves a change in functionality. I also want some time to do some debugging of it in devel
just to make sure that the searches are fast, and that there isn't that will bite us (it all looks ok, but it is a new code path).
Thanks, I agree. While this seems to work and is entirely invisible to the user, it would be good to have some time to test it in the wild and refine as necessary. |
This is a small update to allow water molecules to be flagged as crystal waters when swapping the topology to GROMACS format, which is required prior to performing solvation in BioSimSpace. This change means that we can still solvate around any existing water molecules, but
gmx genion
will ignore them when choosing which water molecules to replace in order to neutralise the system (or reach a specified ion concentration). Following this, we can then update the topology of the crystal waters to the standard template, i.e.SOL
, so that we recover a single solvent group.These changes are related to OpenBioSim/biosimspace#112 and OpenBioSim/biosimspace#148.
devel
into this branch before issuing this pull request (e.g. by runninggit pull origin devel
): [y]Suggested reviewers:
@chryswoods